package cn.community.system.util;

import cn.community.system.domain.Admin;
import cn.community.system.domain.Association;
import cn.community.system.domain.Member;
import org.apache.shiro.SecurityUtils;

public abstract class UserContext {

    /**
     * 通过shiro获取当前登录用户
     * @return
     */
    public static Admin getCurrentAdmin() {
        return (Admin) SecurityUtils.getSubject().getPrincipal();
    }

    public static Member getCurrentMember() {
        return (Member) SecurityUtils.getSubject().getPrincipal();
    }

    public static Association getCurrentAssociation() {
        return (Association) SecurityUtils.getSubject().getPrincipal();
    }

}
